package cn.wolfcode.domain;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Department {
    /** */
    private Long id;

    /** */
    private String name;

    /** */
    private String sn;

    // Department 的 json 格式的字符串数据
    public String toJson() throws JsonProcessingException {
//        return "{\"id\":"+ id +", \"name\":"+ name +", \"sn\":"+ sn +"}";  // 自己拼接
        return new ObjectMapper().writeValueAsString(this); // 使api
    }


}